package com.kamistoat.ruoyiapisystem.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kamistoat.ruoyiapisystem.entity.GenTableColumnEntity;
import com.kamistoat.ruoyiapisystem.service.GenTableColumnService;
import com.kamistoat.common.utils.PageUtils;
import com.kamistoat.common.utils.R;



/**
 * 代码生成业务表字段
 *
 * @author kamistoat
 * @email linjianshanke@163.com
 * @date 2022-08-09 10:34:45
 */
@RestController
@RequestMapping("ruoyiapisystem/gentablecolumn")
public class GenTableColumnController {
    @Autowired
    private GenTableColumnService genTableColumnService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("ruoyiapisystem:gentablecolumn:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = genTableColumnService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{columnId}")
    // @RequiresPermissions("ruoyiapisystem:gentablecolumn:info")
    public R info(@PathVariable("columnId") Long columnId){
		GenTableColumnEntity genTableColumn = genTableColumnService.getById(columnId);

        return R.ok().put("genTableColumn", genTableColumn);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("ruoyiapisystem:gentablecolumn:save")
    public R save(@RequestBody GenTableColumnEntity genTableColumn){
		genTableColumnService.save(genTableColumn);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("ruoyiapisystem:gentablecolumn:update")
    public R update(@RequestBody GenTableColumnEntity genTableColumn){
		genTableColumnService.updateById(genTableColumn);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("ruoyiapisystem:gentablecolumn:delete")
    public R delete(@RequestBody Long[] columnIds){
		genTableColumnService.removeByIds(Arrays.asList(columnIds));

        return R.ok();
    }

}
